import java.util.Scanner;

public class JieCheng {
    static int[] s = {1, 2, 6, 24, 120, 720, 5040, 40320, 362880};

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        while (t-- > 0) {
            int n = scanner.nextInt();
            for (int i = 8; i >= 0; i--) {
                if (n >= s[i]) {
                    n -= s[i];
                    if (n == 0) {
                        System.out.println("Yes");
                        break;
                    }
                }
            }
            if (n != 0)
                System.out.println("No");
        }
    }
}